package myschool.test2;

import myschool.dao.StudentDao;
import myschool.entity.Student;
import myschool.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

/**
 * @author oldliu
 * @since 1.0
 */
public class Cache1 {
    public static void main(String[] args) {
        SqlSession s= MybatisUtil.get();
        StudentDao mapper = s.getMapper(StudentDao.class);
        Student s1 = mapper.get2(5L);
        s.clearCache();
        Student s2 = mapper.get2(5L);
        s.clearCache();
        Student s3 = mapper.get2(5L);
        System.out.println(s1==s2);
        System.out.println(s1==s3);
        MybatisUtil.close(s);
    }
}
